<?php

namespace XWAM\Addon\PXCallSystem\Controller;

class IndexController extends AppbaseController {

    public function index() {
        $this->display();
    }

    public function home() {
        $this->display();
    }

    public function client() {
        $filename = $_SERVER['DOCUMENT_ROOT'] . __ROOT__ . '/Upload/FileTemplate/Client/ver.txt';
        $ver = file_get_contents($filename);
        $this->assign('ver', $ver);
        $this->display();
    }

    public function centserver() {
        $data = M('tgeneral_server')->find();
        $this->assign('data', $data);
        $this->display();
    }

    public function centserver_save() {
        $data['host'] = I('host');
        $data['loginID'] = I('loginID');
        $data['password'] = I('password');
        $data['state'] = I('state');
        $id = I('id');
        if ($id) {
            $data['id'] = $id;
            $result = M('tgeneral_server')->save($data);
        } else {
            $result = M('tgeneral_server')->add($data);
        }
        if (false === $result) {
            $this->ajaxMsg(false, '保存失败');
        } else {
            $this->ajaxMsg(false, '~' . $msg);
        }
    }

}
